#include "lua_native_binding.hpp"
#include "natives.hpp"

namespace lua::native
{
	static void LUA_NATIVE_EVENT_SET_DECISION_MAKER(Ped ped, Hash name)
	{
		EVENT::SET_DECISION_MAKER(ped, name);
	}

	static void LUA_NATIVE_EVENT_CLEAR_DECISION_MAKER_EVENT_RESPONSE(Hash name, int eventType)
	{
		EVENT::CLEAR_DECISION_MAKER_EVENT_RESPONSE(name, eventType);
	}

	static void LUA_NATIVE_EVENT_BLOCK_DECISION_MAKER_EVENT(Hash name, int eventType)
	{
		EVENT::BLOCK_DECISION_MAKER_EVENT(name, eventType);
	}

	static void LUA_NATIVE_EVENT_UNBLOCK_DECISION_MAKER_EVENT(Hash name, int eventType)
	{
		EVENT::UNBLOCK_DECISION_MAKER_EVENT(name, eventType);
	}

	static int LUA_NATIVE_EVENT_ADD_SHOCKING_EVENT_AT_POSITION(int eventType, float x, float y, float z, float duration)
	{
		auto retval = EVENT::ADD_SHOCKING_EVENT_AT_POSITION(eventType, x, y, z, duration);
		return retval;
	}

	static int LUA_NATIVE_EVENT_ADD_SHOCKING_EVENT_FOR_ENTITY(int eventType, Entity entity, float duration)
	{
		auto retval = EVENT::ADD_SHOCKING_EVENT_FOR_ENTITY(eventType, entity, duration);
		return retval;
	}

	static bool LUA_NATIVE_EVENT_IS_SHOCKING_EVENT_IN_SPHERE(int eventType, float x, float y, float z, float radius)
	{
		auto retval = (bool)EVENT::IS_SHOCKING_EVENT_IN_SPHERE(eventType, x, y, z, radius);
		return retval;
	}

	static bool LUA_NATIVE_EVENT_REMOVE_SHOCKING_EVENT(ScrHandle event)
	{
		auto retval = (bool)EVENT::REMOVE_SHOCKING_EVENT(event);
		return retval;
	}

	static void LUA_NATIVE_EVENT_REMOVE_ALL_SHOCKING_EVENTS(bool p0)
	{
		EVENT::REMOVE_ALL_SHOCKING_EVENTS(p0);
	}

	static void LUA_NATIVE_EVENT_REMOVE_SHOCKING_EVENT_SPAWN_BLOCKING_AREAS()
	{
		EVENT::REMOVE_SHOCKING_EVENT_SPAWN_BLOCKING_AREAS();
	}

	static void LUA_NATIVE_EVENT_SUPPRESS_SHOCKING_EVENTS_NEXT_FRAME()
	{
		EVENT::SUPPRESS_SHOCKING_EVENTS_NEXT_FRAME();
	}

	static void LUA_NATIVE_EVENT_SUPPRESS_SHOCKING_EVENT_TYPE_NEXT_FRAME(int eventType)
	{
		EVENT::SUPPRESS_SHOCKING_EVENT_TYPE_NEXT_FRAME(eventType);
	}

	static void LUA_NATIVE_EVENT_SUPPRESS_AGITATION_EVENTS_NEXT_FRAME()
	{
		EVENT::SUPPRESS_AGITATION_EVENTS_NEXT_FRAME();
	}

	void init_native_binding_EVENT(sol::state& L)
	{
		auto EVENT = L["EVENT"].get_or_create<sol::table>();
		EVENT.set_function("SET_DECISION_MAKER", LUA_NATIVE_EVENT_SET_DECISION_MAKER);
		EVENT.set_function("CLEAR_DECISION_MAKER_EVENT_RESPONSE", LUA_NATIVE_EVENT_CLEAR_DECISION_MAKER_EVENT_RESPONSE);
		EVENT.set_function("BLOCK_DECISION_MAKER_EVENT", LUA_NATIVE_EVENT_BLOCK_DECISION_MAKER_EVENT);
		EVENT.set_function("UNBLOCK_DECISION_MAKER_EVENT", LUA_NATIVE_EVENT_UNBLOCK_DECISION_MAKER_EVENT);
		EVENT.set_function("ADD_SHOCKING_EVENT_AT_POSITION", LUA_NATIVE_EVENT_ADD_SHOCKING_EVENT_AT_POSITION);
		EVENT.set_function("ADD_SHOCKING_EVENT_FOR_ENTITY", LUA_NATIVE_EVENT_ADD_SHOCKING_EVENT_FOR_ENTITY);
		EVENT.set_function("IS_SHOCKING_EVENT_IN_SPHERE", LUA_NATIVE_EVENT_IS_SHOCKING_EVENT_IN_SPHERE);
		EVENT.set_function("REMOVE_SHOCKING_EVENT", LUA_NATIVE_EVENT_REMOVE_SHOCKING_EVENT);
		EVENT.set_function("REMOVE_ALL_SHOCKING_EVENTS", LUA_NATIVE_EVENT_REMOVE_ALL_SHOCKING_EVENTS);
		EVENT.set_function("REMOVE_SHOCKING_EVENT_SPAWN_BLOCKING_AREAS", LUA_NATIVE_EVENT_REMOVE_SHOCKING_EVENT_SPAWN_BLOCKING_AREAS);
		EVENT.set_function("SUPPRESS_SHOCKING_EVENTS_NEXT_FRAME", LUA_NATIVE_EVENT_SUPPRESS_SHOCKING_EVENTS_NEXT_FRAME);
		EVENT.set_function("SUPPRESS_SHOCKING_EVENT_TYPE_NEXT_FRAME", LUA_NATIVE_EVENT_SUPPRESS_SHOCKING_EVENT_TYPE_NEXT_FRAME);
		EVENT.set_function("SUPPRESS_AGITATION_EVENTS_NEXT_FRAME", LUA_NATIVE_EVENT_SUPPRESS_AGITATION_EVENTS_NEXT_FRAME);
	}
}
